package com.example.analysis.controller;


import com.example.analysis.domain.EvaluateListInfo;
import com.example.analysis.domain.Rank1;
import com.example.analysis.domain.Rank2;
import com.example.analysis.domain.Semester;
import com.example.analysis.dto.EntireDto;
import com.example.analysis.entity.Course;
import com.example.analysis.entity.Election;
import com.example.analysis.entity.ElectionList;
import com.example.analysis.service.DashBoardService;
import com.example.analysis.service.ElectionListService;
import com.example.analysis.service.EvaluateListStudentService;
import com.example.analysis.utils.Response1;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * @Author：txy
 * @name：DashBoardController
 * @Date：2025/5/18
 * @Filename：DashBoardController
 */
@RestController
@RequestMapping("/dashboard")
public class DashBoardController {
    @Resource
    DashBoardService dashBoardService;
    @Resource
    EvaluateListStudentService evaluateListStudentService;
    @GetMapping("/entire")
    public Response1<EntireDto> getDetail(){
        EntireDto entireDto=new EntireDto();
        entireDto=dashBoardService.getInfo();
        return new Response1<>(20000,"成功",entireDto);
    }


    @GetMapping("/one")
    public  Response1<List<Rank1>> one(@RequestParam("semester") String semester){
//        List<ElectionList> elections=evaluateListStudentService.getOne(semester);
        List<Rank1> list=dashBoardService.getOne(semester);
        return new Response1<>(20000,"成功",list);
    }

    @GetMapping("/two")
    public  Response1<List<Rank2>> two(EvaluateListInfo evaluateListInfo){
        List<EvaluateListInfo> elections=evaluateListStudentService.getList(evaluateListInfo);
        List<Rank2> list=dashBoardService.getTwo(evaluateListInfo);
        return new Response1<>(20000,"成功",list);
    }

    //动态获取学生成绩学期
    @GetMapping("/semester")
    public  Response1<List<String>> getSemester(){
        List<String> list=dashBoardService.getSemester();
        return new Response1<>(20000,"成功",list);
    }

    //动态获取评教学期
    @GetMapping("/semester1")
    public  Response1<List<String>> getSemester1(){
        List<String> list=dashBoardService.getSemester1();
        return new Response1<>(20000,"成功",list);
    }

    //动态获取领导学期
    @GetMapping("/semester2")
    public  Response1<List<String>> getSemester2(){
        List<String> list=dashBoardService.getSemester2();
        return new Response1<>(20000,"成功",list);
    }

}
